<#include "../common/layout/__mainlayout.html">
<#include "../common/__pagination.html">

        <!--设置面包屑-->
        <#assign pageBreadCrumbs>
            <li class="active"><a href="#">应用管理</a></li>
            <li class="active">软件评论管理</li>
        </#assign>
        <#assign pageCss>
            <!-- page specific plugin styles -->
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/chosen.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/daterangepicker.css"/>

        </#assign>

        <#assign pageJavascript>
            <script type="text/javascript">
                $(document).ready(function () {
                    $("#claimType").val(${query.claimType!});
                    $("#resType").val(${query.resType!});

                    //初始化范围选择器
                    $('input[name=createTimeRange]').daterangepicker({
                        'applyClass' : 'btn-sm btn-success',
                        'cancelClass' : 'btn-sm btn-default',
                        locale: {
                            applyLabel: '确定',
                            cancelLabel: '取消'
                        }
                    });


                    $('[data-rel=tooltip]').tooltip();

                    if (!ace.vars['touch']) {
                        $('.chosen-select').chosen({allow_single_deselect: true});
                    }

                    // 清除远程modal数据
                    $("#editModal").on("hidden.bs.modal", function () {
                        $(this).removeData("bs.modal");
                    });

                    // 删除按钮
                    $("a.delete").on(ace.click_event,function (e) {
                        submitClickListener(this,e,"删除");
                    });

                    // 显示按钮
                    $("a.upState").on(ace.click_event,function (e) {
                        submitClickListener(this,e,"显示");
                    });

                    // 隐藏按钮
                    $("a.downState").on(ace.click_event,function (e) {
                        submitClickListener(this,e,"隐藏");
                    });

                    function submitClickListener(obj,e,title){
                        var currentA = obj;
                        e.preventDefault();
                        bootbox.confirm({
                                    message: "确定"+title+"该评论?",
                                    buttons: {
                                        confirm: {
                                            label: "确定",
                                            className: "btn-primary btn-sm"
                                        },
                                        cancel: {
                                            label: "取消",
                                            className: "btn-sm"
                                        }
                                    },
                                    callback: function (result) {
                                        if (result) {
                                            url = $(currentA).attr("href");
                                            $.get(url, { },function(data){
                                                if(data){
                                                    window.location.href=window.location.href;
                                                }
                                            });
                                        }
                                    }
                                }
                        );
                    }
                });
            </script>
        </#assign>

        <@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript currentMenu="ApplicationFlag-softCommmentFlag">
        <div class="row">
            <div class="col-xs-12">
            <form id="searchForm" class="form-search form-inline" action="/admin/soft/commment/list.do">
                <div class="row">
                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-group col-xs-12" style="padding-top:10px">
                                <label class="col-xs-1 text-right">软件名称:</label>
                                <input type="text" id="softName" name="softName" class="input-sm col-xs-2" value="${query.softName!}"/>
                                </select>
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <input  type="button" id="searchBtn" class="btn btn-sm btn-primary" value="查询"/>&nbsp;
                            </div>
                        </div>
                    </div>
                </div>

            <table id="adItemTable" class="table table-striped table-bordered table-hover">
                <thead>
                <tr>
                    <th width="40" align="center">评论编号</th>
                    <th width="100" align="left">软件名称</th>
                    <th width="70" align="left">评论内容</th>
                    <th width="70" align="left">用户id</th>
                    <th width="70" align="left">用户昵称</th>
                    <th width="70" align="left">星级</th>
                    <th width="70" align="center">操作</th>
                </tr>
                </thead>
                <tbody>
                <#list softComments.listData as softComment>
                    <tr>
                        <td>${softComment.commentId!}</td>
                        <td>${softComment.softName!}</td>
                            <td style="text-overflow-ellipsis: true">${softComment.content!}</td>
                        <td>${softComment.userId!}</td>
                        <td>${softComment.userNick!}</td>
                        <td>${softComment.stars!}</td>
                        <td>
                            <div class="hidden-sm hidden-xs action-buttons">
                                <a class="green tooltip-success view" href="${ctx}/admin/soft/commment/view.do?id=${softComment.commentId!}" data-rel="tooltip" data-toggle="modal" data-target="#editModal" title="查看"><span class="label label-default">查看</span></a>
                                <a class="red tooltip-error delete" href="${ctx}/admin/soft/commment/delete.do?id=${softComment.commentId!}" data-rel="tooltip"  title="删除"> <span class="label label-danger">删除</span> </a>
                                <#if softComment.state != 0 >
                                        <a class="green tooltip-warning downState" href="${ctx}/admin/soft/commment/hidden.do?id=${softComment.commentId!}"  data-rel="tooltip" title="隐藏" > <span class="label label-warning">隐藏</span></a>
                                </#if>
                            </div>
                        </td>
                    </tr>
                </#list>
                </tbody>
            </table>
            <@pagination softComments!/>
            </form>
        </div>
        </div>

        <div id="editModal" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                </div>
            </div>
        </div>
    </@mainlayout>